export default function createElement(type, props, ...children) {
  // const childElements = [].concat(children).map(child => {
  //   if (child instanceof Object) {
  //     return child
  //   } else {
  //     return createElement('text', { textContent: child })
  //   }
  // })
  const childElements = [].concat(children).reduce((prev, child) => {
    if (child !== false && child !== true && child !== null) {
      if (child instanceof Object) {
        prev.push(child)
      } else {
        prev.push(createElement('text', { textContent: child }))
      }
    }
    return prev
  }, [])
  return {
    type,
    props: Object.assign({ children: childElements }, props)
  }
}
